﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;
using TiaoTaoHelper.Wtm.Units.EFCore;

#nullable disable

namespace HengTong.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class 部门岗位新增机构 : TransactionalMigration
    {
        /// <inheritdoc />
        protected override void UpWithTransaction(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_SysActivitImages_FileAttachments_FileId",
                table: "SysActivitImages");

            migrationBuilder.DropForeignKey(
                name: "FK_SysArticleAttachments_FileAttachments_FileId",
                table: "SysArticleAttachments");

            migrationBuilder.DropForeignKey(
                name: "FK_SysDailyLeaveRequestBill_FrameworkGroups_GroupId",
                table: "SysDailyLeaveRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysDailyOutFactoryRequestBill_FrameworkGroups_GroupId",
                table: "SysDailyOutFactoryRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrDismissRequestBill_FrameworkGroups_GroupId",
                table: "SysHrDismissRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrRecruitRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRecruitRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrRenewRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRenewRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrResignRequestBill_FrameworkGroups_GroupId",
                table: "SysHrResignRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrRetireRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRetireRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrStaffNeedRequestBill_FrameworkGroups_GroupId",
                table: "SysHrStaffNeedRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrTransferRequestBill_FrameworkGroups_GroupId",
                table: "SysHrTransferRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysJobPositionRole_FrameworkRoles_RoleId",
                table: "SysJobPositionRole");

            migrationBuilder.DropForeignKey(
                name: "FK_SysJobPositionRole_SysJobPosition_JobPositionId",
                table: "SysJobPositionRole");

            migrationBuilder.DropForeignKey(
                name: "FK_SysPersonContractFile_FileAttachments_FileId",
                table: "SysPersonContractFile");

            migrationBuilder.DropForeignKey(
                name: "FK_SysPersonEducationFile_FileAttachments_FileId",
                table: "SysPersonEducationFile");

            migrationBuilder.DropForeignKey(
                name: "FK_SysUserJobPosition_FrameworkUsers_UserId",
                table: "SysUserJobPosition");

            migrationBuilder.DropForeignKey(
                name: "FK_SysUserJobPosition_SysJobPosition_JobPositionId",
                table: "SysUserJobPosition");

            migrationBuilder.DropForeignKey(
                name: "FK_SysVisitorRecordRequestBill_FrameworkGroups_GroupId",
                table: "SysVisitorRecordRequestBill");

            migrationBuilder.DropIndex(
                name: "IX_SysUserJobPosition_UserId_JobPositionId",
                table: "SysUserJobPosition");

            migrationBuilder.DropIndex(
                name: "IX_SysJobPositionRole_JobPositionId_RoleId",
                table: "SysJobPositionRole");

            migrationBuilder.DropColumn(
                name: "CompanyId",
                table: "FrameworkGroups");

            migrationBuilder.DropColumn(
                name: "IsCompany",
                table: "FrameworkGroups");

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysVisitorRecordRequestBill",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "UserId",
                table: "SysUserJobPosition",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "JobPositionId",
                table: "SysUserJobPosition",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<decimal>(
                name: "Score",
                table: "SysPersonTrainExam",
                type: "decimal(10,2)",
                nullable: false,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)");

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalPositionSalary",
                table: "SysPersonResume",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalPerformanceSalary",
                table: "SysPersonResume",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalBaseSalary",
                table: "SysPersonResume",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewPositionSalary",
                table: "SysPersonResume",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewPerformanceSalary",
                table: "SysPersonResume",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewBaseSalary",
                table: "SysPersonResume",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "SalaryReward",
                table: "SysPersonProfessionalTitle",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "FileId",
                table: "SysPersonEducationFile",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "FileId",
                table: "SysPersonContractFile",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<decimal>(
                name: "WorkExperience",
                table: "SysPerson",
                type: "decimal(8,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "RegularSalary",
                table: "SysPerson",
                type: "decimal(8,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldMaxLength: 128,
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "ProbationSalary",
                table: "SysPerson",
                type: "decimal(8,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldMaxLength: 128,
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "ExpectedSalary",
                table: "SysPerson",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "CurrentSalary",
                table: "SysPerson",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "RoleId",
                table: "SysJobPositionRole",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "JobPositionId",
                table: "SysJobPositionRole",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalPositionSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalPerformanceSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalBaseSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewPositionSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewPerformanceSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewBaseSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(10,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrTransferRequestBill",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrStaffNeedRequestBill",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrRetireRequestBill",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrResignRequestBill",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrRenewRequestBill",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrRecruitRequestBill",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrDismissRequestBill",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysDailyOutFactoryRequestBill",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysDailyLeaveRequestBill",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<decimal>(
                name: "Days",
                table: "SysDailyLeaveRequestBill",
                type: "decimal(8,2)",
                nullable: false,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)");

            migrationBuilder.AlterColumn<Guid>(
                name: "FileId",
                table: "SysArticleAttachments",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.AlterColumn<Guid>(
                name: "FileId",
                table: "SysActivitImages",
                type: "uniqueidentifier",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier");

            migrationBuilder.CreateTable(
                name: "SysGroupOrg",
                columns: table => new
                {
                    ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    GroupId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OrgId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SysGroupOrg", x => x.ID);
                    table.ForeignKey(
                        name: "FK_SysGroupOrg_FrameworkGroups_GroupId",
                        column: x => x.GroupId,
                        principalTable: "FrameworkGroups",
                        principalColumn: "ID");
                    table.ForeignKey(
                        name: "FK_SysGroupOrg_SysOrg_OrgId",
                        column: x => x.OrgId,
                        principalTable: "SysOrg",
                        principalColumn: "ID");
                });

            migrationBuilder.CreateTable(
                name: "SysJobPositionOrg",
                columns: table => new
                {
                    ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    JobPositionId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    OrgId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SysJobPositionOrg", x => x.ID);
                    table.ForeignKey(
                        name: "FK_SysJobPositionOrg_SysJobPosition_JobPositionId",
                        column: x => x.JobPositionId,
                        principalTable: "SysJobPosition",
                        principalColumn: "ID");
                    table.ForeignKey(
                        name: "FK_SysJobPositionOrg_SysOrg_OrgId",
                        column: x => x.OrgId,
                        principalTable: "SysOrg",
                        principalColumn: "ID");
                });

            migrationBuilder.CreateIndex(
                name: "IX_SysUserJobPosition_UserId_JobPositionId",
                table: "SysUserJobPosition",
                columns: new[] { "UserId", "JobPositionId" },
                unique: true,
                filter: "[UserId] IS NOT NULL AND [JobPositionId] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_SysJobPositionRole_JobPositionId_RoleId",
                table: "SysJobPositionRole",
                columns: new[] { "JobPositionId", "RoleId" },
                unique: true,
                filter: "[JobPositionId] IS NOT NULL AND [RoleId] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_SysGroupOrg_GroupId",
                table: "SysGroupOrg",
                column: "GroupId");

            migrationBuilder.CreateIndex(
                name: "IX_SysGroupOrg_OrgId",
                table: "SysGroupOrg",
                column: "OrgId");

            migrationBuilder.CreateIndex(
                name: "IX_SysJobPositionOrg_JobPositionId",
                table: "SysJobPositionOrg",
                column: "JobPositionId");

            migrationBuilder.CreateIndex(
                name: "IX_SysJobPositionOrg_OrgId",
                table: "SysJobPositionOrg",
                column: "OrgId");

            migrationBuilder.AddForeignKey(
                name: "FK_SysActivitImages_FileAttachments_FileId",
                table: "SysActivitImages",
                column: "FileId",
                principalTable: "FileAttachments",
                principalColumn: "ID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_SysArticleAttachments_FileAttachments_FileId",
                table: "SysArticleAttachments",
                column: "FileId",
                principalTable: "FileAttachments",
                principalColumn: "ID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_SysDailyLeaveRequestBill_FrameworkGroups_GroupId",
                table: "SysDailyLeaveRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysDailyOutFactoryRequestBill_FrameworkGroups_GroupId",
                table: "SysDailyOutFactoryRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrDismissRequestBill_FrameworkGroups_GroupId",
                table: "SysHrDismissRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrRecruitRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRecruitRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrRenewRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRenewRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrResignRequestBill_FrameworkGroups_GroupId",
                table: "SysHrResignRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrRetireRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRetireRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrStaffNeedRequestBill_FrameworkGroups_GroupId",
                table: "SysHrStaffNeedRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrTransferRequestBill_FrameworkGroups_GroupId",
                table: "SysHrTransferRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysJobPositionRole_FrameworkRoles_RoleId",
                table: "SysJobPositionRole",
                column: "RoleId",
                principalTable: "FrameworkRoles",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysJobPositionRole_SysJobPosition_JobPositionId",
                table: "SysJobPositionRole",
                column: "JobPositionId",
                principalTable: "SysJobPosition",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysPersonContractFile_FileAttachments_FileId",
                table: "SysPersonContractFile",
                column: "FileId",
                principalTable: "FileAttachments",
                principalColumn: "ID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_SysPersonEducationFile_FileAttachments_FileId",
                table: "SysPersonEducationFile",
                column: "FileId",
                principalTable: "FileAttachments",
                principalColumn: "ID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_SysUserJobPosition_FrameworkUsers_UserId",
                table: "SysUserJobPosition",
                column: "UserId",
                principalTable: "FrameworkUsers",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysUserJobPosition_SysJobPosition_JobPositionId",
                table: "SysUserJobPosition",
                column: "JobPositionId",
                principalTable: "SysJobPosition",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysVisitorRecordRequestBill_FrameworkGroups_GroupId",
                table: "SysVisitorRecordRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");
        }



        /// <inheritdoc />
        protected override void DownWithTransaction(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_SysActivitImages_FileAttachments_FileId",
                table: "SysActivitImages");

            migrationBuilder.DropForeignKey(
                name: "FK_SysArticleAttachments_FileAttachments_FileId",
                table: "SysArticleAttachments");

            migrationBuilder.DropForeignKey(
                name: "FK_SysDailyLeaveRequestBill_FrameworkGroups_GroupId",
                table: "SysDailyLeaveRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysDailyOutFactoryRequestBill_FrameworkGroups_GroupId",
                table: "SysDailyOutFactoryRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrDismissRequestBill_FrameworkGroups_GroupId",
                table: "SysHrDismissRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrRecruitRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRecruitRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrRenewRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRenewRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrResignRequestBill_FrameworkGroups_GroupId",
                table: "SysHrResignRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrRetireRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRetireRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrStaffNeedRequestBill_FrameworkGroups_GroupId",
                table: "SysHrStaffNeedRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysHrTransferRequestBill_FrameworkGroups_GroupId",
                table: "SysHrTransferRequestBill");

            migrationBuilder.DropForeignKey(
                name: "FK_SysJobPositionRole_FrameworkRoles_RoleId",
                table: "SysJobPositionRole");

            migrationBuilder.DropForeignKey(
                name: "FK_SysJobPositionRole_SysJobPosition_JobPositionId",
                table: "SysJobPositionRole");

            migrationBuilder.DropForeignKey(
                name: "FK_SysPersonContractFile_FileAttachments_FileId",
                table: "SysPersonContractFile");

            migrationBuilder.DropForeignKey(
                name: "FK_SysPersonEducationFile_FileAttachments_FileId",
                table: "SysPersonEducationFile");

            migrationBuilder.DropForeignKey(
                name: "FK_SysUserJobPosition_FrameworkUsers_UserId",
                table: "SysUserJobPosition");

            migrationBuilder.DropForeignKey(
                name: "FK_SysUserJobPosition_SysJobPosition_JobPositionId",
                table: "SysUserJobPosition");

            migrationBuilder.DropForeignKey(
                name: "FK_SysVisitorRecordRequestBill_FrameworkGroups_GroupId",
                table: "SysVisitorRecordRequestBill");

            migrationBuilder.DropTable(
                name: "SysGroupOrg");

            migrationBuilder.DropTable(
                name: "SysJobPositionOrg");

            migrationBuilder.DropIndex(
                name: "IX_SysUserJobPosition_UserId_JobPositionId",
                table: "SysUserJobPosition");

            migrationBuilder.DropIndex(
                name: "IX_SysJobPositionRole_JobPositionId_RoleId",
                table: "SysJobPositionRole");

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysVisitorRecordRequestBill",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "UserId",
                table: "SysUserJobPosition",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "JobPositionId",
                table: "SysUserJobPosition",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "Score",
                table: "SysPersonTrainExam",
                type: "decimal(18,2)",
                nullable: false,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)");

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalPositionSalary",
                table: "SysPersonResume",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalPerformanceSalary",
                table: "SysPersonResume",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalBaseSalary",
                table: "SysPersonResume",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewPositionSalary",
                table: "SysPersonResume",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewPerformanceSalary",
                table: "SysPersonResume",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewBaseSalary",
                table: "SysPersonResume",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "SalaryReward",
                table: "SysPersonProfessionalTitle",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "FileId",
                table: "SysPersonEducationFile",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "FileId",
                table: "SysPersonContractFile",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "WorkExperience",
                table: "SysPerson",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(8,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "RegularSalary",
                table: "SysPerson",
                type: "decimal(18,2)",
                maxLength: 128,
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(8,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "ProbationSalary",
                table: "SysPerson",
                type: "decimal(18,2)",
                maxLength: 128,
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(8,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "ExpectedSalary",
                table: "SysPerson",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "CurrentSalary",
                table: "SysPerson",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "RoleId",
                table: "SysJobPositionRole",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "JobPositionId",
                table: "SysJobPositionRole",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalPositionSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalPerformanceSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "OriginalBaseSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewPositionSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewPerformanceSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "NewBaseSalary",
                table: "SysHrTransferRequestBill",
                type: "decimal(18,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(10,2)",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrTransferRequestBill",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrStaffNeedRequestBill",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrRetireRequestBill",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrResignRequestBill",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrRenewRequestBill",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrRecruitRequestBill",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysHrDismissRequestBill",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysDailyOutFactoryRequestBill",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "GroupId",
                table: "SysDailyLeaveRequestBill",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<decimal>(
                name: "Days",
                table: "SysDailyLeaveRequestBill",
                type: "decimal(18,2)",
                nullable: false,
                oldClrType: typeof(decimal),
                oldType: "decimal(8,2)");

            migrationBuilder.AlterColumn<Guid>(
                name: "FileId",
                table: "SysArticleAttachments",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AlterColumn<Guid>(
                name: "FileId",
                table: "SysActivitImages",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uniqueidentifier",
                oldNullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "CompanyId",
                table: "FrameworkGroups",
                type: "uniqueidentifier",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IsCompany",
                table: "FrameworkGroups",
                type: "bit",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_SysUserJobPosition_UserId_JobPositionId",
                table: "SysUserJobPosition",
                columns: new[] { "UserId", "JobPositionId" },
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_SysJobPositionRole_JobPositionId_RoleId",
                table: "SysJobPositionRole",
                columns: new[] { "JobPositionId", "RoleId" },
                unique: true);

            migrationBuilder.AddForeignKey(
                name: "FK_SysActivitImages_FileAttachments_FileId",
                table: "SysActivitImages",
                column: "FileId",
                principalTable: "FileAttachments",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysArticleAttachments_FileAttachments_FileId",
                table: "SysArticleAttachments",
                column: "FileId",
                principalTable: "FileAttachments",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysDailyLeaveRequestBill_FrameworkGroups_GroupId",
                table: "SysDailyLeaveRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysDailyOutFactoryRequestBill_FrameworkGroups_GroupId",
                table: "SysDailyOutFactoryRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrDismissRequestBill_FrameworkGroups_GroupId",
                table: "SysHrDismissRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrRecruitRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRecruitRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrRenewRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRenewRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrResignRequestBill_FrameworkGroups_GroupId",
                table: "SysHrResignRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrRetireRequestBill_FrameworkGroups_GroupId",
                table: "SysHrRetireRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrStaffNeedRequestBill_FrameworkGroups_GroupId",
                table: "SysHrStaffNeedRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysHrTransferRequestBill_FrameworkGroups_GroupId",
                table: "SysHrTransferRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysJobPositionRole_FrameworkRoles_RoleId",
                table: "SysJobPositionRole",
                column: "RoleId",
                principalTable: "FrameworkRoles",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysJobPositionRole_SysJobPosition_JobPositionId",
                table: "SysJobPositionRole",
                column: "JobPositionId",
                principalTable: "SysJobPosition",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysPersonContractFile_FileAttachments_FileId",
                table: "SysPersonContractFile",
                column: "FileId",
                principalTable: "FileAttachments",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysPersonEducationFile_FileAttachments_FileId",
                table: "SysPersonEducationFile",
                column: "FileId",
                principalTable: "FileAttachments",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysUserJobPosition_FrameworkUsers_UserId",
                table: "SysUserJobPosition",
                column: "UserId",
                principalTable: "FrameworkUsers",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysUserJobPosition_SysJobPosition_JobPositionId",
                table: "SysUserJobPosition",
                column: "JobPositionId",
                principalTable: "SysJobPosition",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SysVisitorRecordRequestBill_FrameworkGroups_GroupId",
                table: "SysVisitorRecordRequestBill",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);
        }


    }
}
